<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://www.ccut.edu.cn/saturn" prefix="saturn"%>
<%@page import="java.util.List"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Map"%>
<%@page import="edu.ccut.saturn.component.SaturnData"%>
<%@page import="org.osgi.framework.Bundle"%>
<%@page import="edu.ccut.saturn.component.IComponentInfo"%>
<%@page import="java.util.Dictionary"%>
<%@page import="edu.ccut.saturn.component.ComponentFactory"%>
<%@page import="edu.ccut.saturn.component.IValidateInfo"%>
<%@page import="edu.ccut.saturn.component.IWorkFlowInfo"%>


<html>
<head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/edu.ccut.saturn.manager.bundles.impl/componentModule/page/js/rkxt/common/css/dhtmlXTree.css">

<%@ include file="/jsp/include/header/meta.jsp"%>
<%@ include file="/jsp/include/header/javascript.jsp"%>
<%@ include file="/jsp/include/header/stylesheettag.jsp"%>
<%
	Bundle bundle = (Bundle) request.getAttribute("bundle");
	String symbolicName = bundle.getSymbolicName();
%>
<script language="javascript">
	//打开事件
	function tonOpenclick(id,mode){
	//getParentId(id);
		if(mode == -1) {
			return true;
		}
		if(mode == 1){
			tree.selectItem(id);
			tonclick(id); 
			return true;
		}
		var lev = tree.getLevel(id);
		if(lev>=2){
			var action = "<%=request.getContextPath()%>/edu.ccut.saturn.manager.bundles.impl::/componentModule/action/GetChildTreeAction.action";
			var param = "key="+"<%=symbolicName%>"+"&treeId="+id;
			tree.loadFXML(action,param);
			
		}else{
			return true;
		}		
	}
	
	//单击事件
	function tonclick(id){
	    
		if(id.indexOf(".")>-1){
		    //判断是组件还是数据项
		      "/dafa/aa.saturnData"
		    var type = id.split(".")[1];
		   // http://edu.ccut.saturn.manager.bundles.impl/componentModule/data.saturnData
		    if(type == "saturnData"){
		        var param = "fullKey=http://<%=symbolicName%>/"+id.split(".")[0];
		        param = param.substring(0, param.lastIndexOf("/"))+"::"+ param.substring(param.lastIndexOf("/")+1,param.length);
		        //数据项验证的验证
		        action = "<%=request.getContextPath()%>/edu.ccut.saturn.manager.bundles.impl::/componentModule/tdValidateAction/QuerySaturnDataInfoByFullKey.action?"+param;
		        document.frames['ComponentInfo'].location = action;
		    }else{
			    var param = "fullKey=<%=symbolicName%>"+"::/"+id;
				action = "<%=request.getContextPath()%>/edu.ccut.saturn.manager.bundles.impl::/componentModule/action/QueryComponentInfoByFullKey.action?"+param;		
				//window.open(action,"_self");
				document.frames['ComponentInfo'].location = action;
		    }
			
		}
		
	}
	//双击事件
	function tonDbclick(id) {

	}
	
	//初始化组件树
	function initComponentTree(treeId){
		tree=new dhtmlXTreeObject(treeId,"100%","100%",0);
		tree.setImagePath(urlpath + "/edu.ccut.saturn.manager.bundles.impl/componentModule/page/menuTree/");
		var action = "<%=request.getContextPath()%>/edu.ccut.saturn.manager.bundles.impl::/componentModule/action/GetComponentTreeAction.action";
		
		var param = "key="+"<%=symbolicName%>";
		tree.setXMLAutoLoading(action);	
		tree.loadFXML(action,param);
		
		tree.setOnOpenStartHandler(tonOpenclick);
		tree.setOnClickHandler(tonclick);
		tree.setOnDblClickHandler(tonDbclick);
		
	}
	
</script>
<title>bundle信息</title>
</head>
<body onload="initComponentTree(tree_id)">
	<%
	if (bundle != null) {
	%>
	<!-- 
		<table>
			<tr>
				<td class="saturn-style-title" colspan="2">bundle信息描述</td>
			</tr>
			<tr>
				<td class="saturn-style-td-label" width="100">bundle名称：</td>
				<td class="saturn-style-td-tag">< %=bundle.getSymbolicName()%></td>
			</tr>
			< % 
				String url = bundle.getLocation();
				String bundleFileName = "";
				String bundleFilePath = "";
				if (url.indexOf("\\") != -1) {
					bundleFileName = url.substring(url.lastIndexOf("\\") + 1);
					bundleFilePath = url.substring(0, url.lastIndexOf("\\"));
				} else {
					bundleFileName = url;
				} 
			%>
			<tr>
				<td class="saturn-style-td-label" width="100">文件夹名：</td>
				<td class="saturn-style-td-tag">< %=bundleFilePath%></td>
			</tr>
			<tr>
				<td class="saturn-style-td-label" width="100">bundle文件名：</td>
				<td class="saturn-style-td-tag">< %=bundleFileName%></td>
			</tr>
			
		</table> -->
		
		
	<form name="deptListForm" action="">                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
		<saturn:splitpanel orientation="horizontal" id="splitpanel_h" position="200">
			<div id="tree_id" style="width:100%;height:100%;border: 1px solid Silver;OVERFLOW-X:auto;OVERFLOW:auto;">
			</div>
			<saturn:splitter />
			<iframe name="ComponentInfo" width="100%" height="100%"></iframe>
		</saturn:splitpanel>
	</form>
			
	<%
	} else {
	%>
		该组件被卸载或是不存在，没有该组件的信息。
	<%
	}
	%>
</body>
</html>